using System;
#if UNITY_EDITOR
using UnityEditor;
#endif


namespace HEFramework
{
    /// <summary>
    ///
    /// Unity模式
    /// 
    /// ----------------------------------------
    /// 作者 hep
    /// 创建时间：2023-12-21 14:27:10
    /// ----------------------------------------
    /// </summary>
    public class Unity_AssetLoad : IAssetLoad
    {
        public T LoadAssetSyn<T>(string _assetBundleName, string _assetName, string _extension) where T : UnityEngine.Object
        {
#if UNITY_EDITOR
            string assetBundleName = _assetBundleName.ToLower();
            string filePath = AssetBundleSettingScriptableObject.Instance.GetAssetBundleDataLoadPath() + "/" + assetBundleName + "/" + (_assetName + _extension);
            return AssetDatabase.LoadAssetAtPath<T>(filePath);
#endif
            return null;
        }

        public void LoadAssetAsync<T>(string _assetBundleName, string _assetName, string _extension, Action<T> _callback) where T : UnityEngine.Object
        {
#if UNITY_EDITOR
            string assetBundleName = _assetBundleName.ToLower();
            string filePath = AssetBundleSettingScriptableObject.Instance.GetAssetBundleDataLoadPath() + "/" + assetBundleName + "/" + (_assetName + _extension);
            _callback(AssetDatabase.LoadAssetAtPath<T>(filePath));
#endif
        }

        public void UnLoadAssetAsync(string _assetBundleName)
        {
        }
    }
}